package activiti;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;
import org.junit.Test;

public class activiti {
   @Test
   public void createTable() {
	   //創建Activiti配置對象的實例
	   ProcessEngineConfiguration configuration =  ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
	   //設置數據庫的連接信息
	   configuration.setJdbcUrl("jdbc:mysql://localhost:3306/activiti");
	   //設置數據庫驅動
	   configuration.setJdbcDriver("com.mysql.jdbc.Driver");
	   //設置用戶名密碼
	   configuration.setJdbcUsername("root");
	   configuration.setJdbcPassword("123456");
	   //設置數據庫生成策略
	   configuration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
	   //使用配置对象创建流程引擎实例(检查配置数据库环境是否正确)
	   ProcessEngine engine = configuration.buildProcessEngine();
	   System.out.println(engine);
   }
   
   @Test
   public void createTable2() {
	   ProcessEngine engine = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("config/activiti.cfg.xml").buildProcessEngine();
   }
   
   
}
